<h1>Lista contratti in scadenza</h1>
<%= link_to 'Tutti', { :action => "index" } %>
<br /><br />

<table>
  <tr>
    <th>Codice</th>
    <th>Cliente</th>
    <th>Scadenza</th>
    <th>Attivazione</th>
    <th colspan="3">Comandi</th>
  </tr>

<% for contract in @contracts %>
  <tr>
    <td><%= contract.code %></td>
    <td><%= Client.find(contract.client_id).name_or_society %></td>
    <td><%= contract.expiration.strftime("%d %B %Y") %></td>
    <td><%= contract.created_at.strftime("%d %B %Y") %></td>
    <td><%= link_to image_tag("info.png", :alt => "show"), { :action => "show", :id => contract } %></td>
    <td><%= link_to image_tag("edit.png", :alt => "edit"), { :action => "edit", :id => contract } %></td>
    <td><%= link_to image_tag("delete.png", :alt => "delete"), { :action => "destroy", :id => contract }, :confirm => 'Sei sicuro?', :method => :delete %></td>
  </tr>
<% end %>
</table>
<%= will_paginate @contracts, option = {:inner_window => 2, :outer_window => 3} %>
